// Proxy
// Object.defineProperty 区别

// defineProperty 只能监视属性的读写
// Proxy 能够监视更多操作， 如delete

const Person = {
    name: "张三",
    age: 18
}

const per = new Proxy(Person, {
    deleteProperty(target, property) {
        console.log("delete", property)
        delete target[property]
    }
})
delete per.age

const list = []
const listProxy = new Proxy(list, {
    set(target, property, value) {
        target[property] = value
        return true
    }
})
listProxy.push(100)